<!DOCTYPE html>
<html>

{include file='public/header'}


<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">用户管理</a>
            <a><cite>粉丝管理</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <div class="layui-row">
            <form class="layui-form">
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">用户ID：</label>
                    <div class="layui-input-inline" style="width:110px">
                        <input type="text" name="id" placeholder="请输入用户id" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">链接ID：</label>
                    <div class="layui-input-inline" style="width:110px">
                        <input type="text" name="link_id" placeholder="请输入链接id" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label w-auto">投放计划ID：</label>
                    <div class="layui-input-inline" style="width:160px">
                        <input type="text" name="advertiser_id" placeholder="请输入投放计划id" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label w-auto">关注状态：</label>
                    <div class="layui-input-inline" style="width:80px">
                        <select name="status" id="status">
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">注册时间：</label>
                    <div class="layui-input-block" style="width:120px">
                        <input type="text" class="layui-input" name="register_date" id="register_date" placeholder="选择时间">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label w-auto">关注时间：</label>
                    <div class="layui-input-block" style="width:120px">
                        <input type="text" class="layui-input" name="follow_date" id="follow_date" placeholder="选择时间">
                    </div>
                </div>
                <button class="layui-btn" style="margin-left: 10px;" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </form>
        </div>

        <table id="video" lay-filter="video"></table>
    </div>
    <script type="text/html" id="tbBar">
        <a class="layui-btn layui-btn-xs" lay-event="look">查看详情</a>
    </script>
    <script>
        let params = {
            elem: '#video'
            , toolbar: '#toolbarDemo'
            , url: '/cps/user/list' //数据接口
            , page: true //开启分页
            , id: 'video'
            , limit:15
            , cols: [[//表头
                { field: 'id', title: '用户ID', width: 120, sort: true, align:'center'}
                , { field: 'mobile_system', title: '手机系统', align:'center', width: 100 }
                // , { field: 'user_name', title: '昵称', width: 100, align:'center' }
                // , {
                //     field: 'avatar', title: '头像', align:'center', width: 100, templet: function (d) {
                //         if (d.avatar) {
                //             return `<div class="layer-photos" style="cursor:pointer;height: 100%;">
                //                     <img onclick="showimg(this)" style="height: 100%;" src=`+ d.avatar + ` alt="">
                //                 </div>`;
                //         } else {
                //             return `<div>暂无照片</div>`
                //         }
                //     }
                // }
                , { field: 'link_id', title: '链接ID', align:'center', width: 80 }
                , { field: 'activation_time', title: '激活时间', width: 160, align:'center' }
                , { field: 'advertiser_id', title: '投放计划id', align:'center' }
                , { title: '是否是会员', align:'center', width: 100, templet: function (d) {
                        return d.is_members === 0 ? '否' : '是'
                    }
                }
                , { title: '会员到期时间', align:'center', width: 160, templet: function (d) {
                        return dayjsFormat(d.expiration_time)
                    }
                }
                , { field: 'money', title: '余额(K币)', width: 100, align:'center' }

                , { title: '首充时间', align:'center', width: 160, templet: function (d) {
                        return dayjsFormat(d.first_charge_date)
                    }
                }
                , { title: '最近一次登录时间', align:'center', width: 160, templet: function (d) {
                        return dayjsFormat(d.last_login_time)
                    }
                }
                // , { title: '关注状态', align:'center', width: 100, templet: function (d) {
                //         return d.status === 0 ? '否' : '是'
                //     }
                // }
                // , { title: '公众号注册时间', align:'center', width: 160, templet: function (d) {
                //         return dayjsFormat(d.official_account_created_at)
                //     }
                // }
                , { field: 'created_at', title: '注册时间', align:'center', width: 160 }
                // , { title: '取关时间', align:'center', width: 160, templet: function (d) {
                //         return dayjsFormat(d.closing_time)
                //     }
                // }
                , { toolbar: '#tbBar', title: '操作', align:'center', width: 130}
            ]]

        }
        tableList(params)

        layui.use('table', function () {
            var table = layui.table;
            
            table.on('tool(video)', function (obj) {
                var event = obj.event;
                if (event === 'look') {
                    x_admin_show(`查看详情`, `./info.html?id=${obj.data.id}`, 1200, 573,null);
                }
            });

        });

        layui.use('laydate', function(){
            layui.laydate.render({
                elem: '#register_date'
            });
            layui.laydate.render({
                elem: '#follow_date'
            });
        })
    </script>

</body>

</html>